package com.jfinal.model.auth;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Record;

import java.util.List;

/**
 * Created by xiaoyuan on 2018/1/18.
 */
public class User extends Model<User> {
    public static final User dao = new User().dao();
    private String findRoles4User = Db.getSql("auth.findRoles4User");

    /**
     * 获取用户的所有角色
     * @return
     */
    public List<Role> getRoles(){
        return Role.dao.find(findRoles4User,get("id"));
    }
}
